/**
 * Created with CLion.
 * Description: 
 * User: cyber
 * Date: 2020-09-02
 * Time: 8:56
 */
#include <iostream>
#include <thread>

using namespace std;

typedef std::string user_command;

void open_document_and_display_gui(const string &basicString)
{

}
bool done_editing()
{
    return false;
}

user_command get_user_input()
{
    return user_command();
}
const std::string get_filename_from_user()
{
    return std::string();
}
void process_user_input(user_command basicString)
{

}

void edit_document(std::string const &filename)
{
    open_document_and_display_gui(filename);
    while (!done_editing()) {
        user_command cmd = get_user_input();
        std::string  open_new_document;
        if (cmd == open_new_document) {
            std::string const new_name = get_filename_from_user();
            std::thread t(edit_document, new_name);         // 1
            t.detach();                                     // 2
        }
        else {
            process_user_input(cmd);
        }
    }
}